﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Data;

namespace Model
{
    [Serializable]
    public partial class Pot3b00
    {
		private double _pamt;
        private int? _calcode;
		private double _bprice;
		private double _price;
		private string _pbrand;
		private string _um;
		private string _level;
        private int? _status;
		private string _pclass;
		private string _propty;
		private string _ptype;
		private string _barcode;
		private string _pid;
		private string _productname;
		private string _productcode;
		private string _changetype;
        private DateTime? _changedate;
		private string _usercode;
		private string _listid;
		
        /// <summary>
        /// 成本
        /// </summary>
		public double Pamt
		{
			get { return _pamt;	 }
			set { _pamt=value;	}
		}
        /// <summary>
        /// 成本核算方式
        /// </summary>
		public int? Calcode
		{
			get { return _calcode;	 }
			set { _calcode=value;	}
		}
        /// <summary>
        /// 出货价
        /// </summary>
		public double Bprice
		{
			get { return _bprice;	 }
			set { _bprice=value;	}
		}
        /// <summary>
        /// 进价
        /// </summary>
		public double Price
		{
			get { return _price;	 }
			set { _price=value;	}
		}
        /// <summary>
        /// 品牌
        /// </summary>
		public string Pbrand
		{
			get { return _pbrand;	 }
			set { _pbrand=value;	}
		}
        /// <summary>
        /// 单位
        /// </summary>
		public string Um
		{
			get { return _um;	 }
			set { _um=value;	}
		}
        /// <summary>
        /// 等级
        /// </summary>
		public string Level
		{
			get { return _level;	 }
			set { _level=value;	}
		}
        /// <summary>
        /// 状态
        /// </summary>
		public int? Status
		{
			get { return _status;	 }
			set { _status=value;	}
		}
        /// <summary>
        /// 类别
        /// </summary>
		public string Pclass
		{
			get { return _pclass;	 }
			set { _pclass=value;	}
		}
        /// <summary>
        /// 商品属性
        /// </summary>
		public string Propty
		{
			get { return _propty;	 }
			set { _propty=value;	}
		}
        /// <summary>
        /// 分类信息
        /// </summary>
		public string Ptype
		{
			get { return _ptype;	 }
			set { _ptype=value;	}
		}
        /// <summary>
        /// 条形码
        /// </summary>
		public string Barcode
		{
			get { return _barcode;	 }
			set { _barcode=value;	}
		}
        /// <summary>
        /// 商品标识
        /// </summary>
		public string Pid
		{
			get { return _pid;	 }
			set { _pid=value;	}
		}
        /// <summary>
        /// 商品名称
        /// </summary>
		public string Productname
		{
			get { return _productname;	 }
			set { _productname=value;	}
		}
        /// <summary>
        /// 商品代码
        /// </summary>
		public string Productcode
		{
			get { return _productcode;	 }
			set { _productcode=value;	}
		}
        /// <summary>
        /// Y/N：原值/新值
        /// </summary>
		public string Changetype
		{
			get { return _changetype;	 }
			set { _changetype=value;	}
		}
        /// <summary>
        /// 维护时间
        /// </summary>
		public DateTime? Changedate
		{
			get { return _changedate;	 }
			set { _changedate=value;	}
		}
        /// <summary>
        /// 用户名
        /// </summary>
		public string Usercode
		{
			get { return _usercode;	 }
			set { _usercode=value;	}
		}
        /// <summary>
        /// 主键标识
        /// </summary>
		public string Listid
		{
			get { return _listid;	 }
			set { _listid=value;	}
		}
		
		public static List<Pot3b00> GetPot3b00ListByDataTable(DataTable dt)
		{
			if(dt == null) return null;
		    List<Pot3b00> list = new List<Pot3b00>();
		   
			foreach(DataRow dr in dt.Rows)
            {
				Pot3b00 model = GetPot3b00ByDataRow(dr);
				if(null == model) continue;
				
				list.Add(model);
            }
           return list;
		}
		
		public static Pot3b00 GetPot3b00ByDataRow(DataRow dr)
		{
			Pot3b00 model = new Pot3b00(); //实例化Pot3b00
	
			DataColumnCollection dcc = dr.Table.Columns;

			if (dcc.Contains("pamt")&&!(dr["pamt"] is System.DBNull))  
				model.Pamt = Convert.ToDouble(dr["pamt"]);
			if (dcc.Contains("calcode")&&!(dr["calcode"] is System.DBNull))  
				model.Calcode = ( int)dr["calcode"];
			if (dcc.Contains("bprice")&&!(dr["bprice"] is System.DBNull))  
				model.Bprice = Convert.ToDouble(dr["bprice"]);
			if (dcc.Contains("price")&&!(dr["price"] is System.DBNull))  
				model.Price = Convert.ToDouble(dr["price"]);
			if (dcc.Contains("pbrand")&&!(dr["pbrand"] is System.DBNull))  
				model.Pbrand = ( string)dr["pbrand"];
			if (dcc.Contains("um")&&!(dr["um"] is System.DBNull))  
				model.Um = ( string)dr["um"];
			if (dcc.Contains("level")&&!(dr["level"] is System.DBNull))  
				model.Level = ( string)dr["level"];
			if (dcc.Contains("status")&&!(dr["status"] is System.DBNull))  
				model.Status = ( int)dr["status"];
			if (dcc.Contains("pclass")&&!(dr["pclass"] is System.DBNull))  
				model.Pclass = ( string)dr["pclass"];
			if (dcc.Contains("propty")&&!(dr["propty"] is System.DBNull))  
				model.Propty = ( string)dr["propty"];
			if (dcc.Contains("ptype")&&!(dr["ptype"] is System.DBNull))  
				model.Ptype = ( string)dr["ptype"];
			if (dcc.Contains("barcode")&&!(dr["barcode"] is System.DBNull))  
				model.Barcode = ( string)dr["barcode"];
			if (dcc.Contains("pid")&&!(dr["pid"] is System.DBNull))  
				model.Pid = ( string)dr["pid"];
			if (dcc.Contains("productname")&&!(dr["productname"] is System.DBNull))  
				model.Productname = ( string)dr["productname"];
			if (dcc.Contains("productcode")&&!(dr["productcode"] is System.DBNull))  
				model.Productcode = ( string)dr["productcode"];
			if (dcc.Contains("changetype")&&!(dr["changetype"] is System.DBNull))  
				model.Changetype = ( string)dr["changetype"];
			if (dcc.Contains("changedate")&&!(dr["changedate"] is System.DBNull))  
				model.Changedate = ( DateTime)dr["changedate"];
			if (dcc.Contains("usercode")&&!(dr["usercode"] is System.DBNull))  
				model.Usercode = ( string)dr["usercode"];
			if (dcc.Contains("listid")&&!(dr["listid"] is System.DBNull))  
				model.Listid = ( string)dr["listid"];
			
			return model;
		}
    }
}
